package com.pomr.util.communication.cx218;

import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

import com.alibaba.fastjson.JSONObject;
import com.pomr.util.communication.Communication;
import com.pomr.util.communication.cx215.CX215Back;

/**
 * 
 * 类名称： CX218Back
 * 创建人： Administrator
 * 创建时间：2018年5月8日 下午2:38:59
 * 类描述：2.1.8 单卡近 6 个月充值详情接口 出参
 */
public class CX218Back implements Communication,Serializable{
	
	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getCodeName() {
		return codeName;
	}

	public void setCodeName(String codeName) {
		this.codeName = codeName;
	}

	public List<CX218BackBase> getRechargeInfo() {
		return rechargeInfo;
	}

	public void setRechargeInfo(List<CX218BackBase> rechargeInfo) {
		this.rechargeInfo = rechargeInfo;
	}

	private int code;//查询状态
	private String codeName;
	private List<CX218BackBase> rechargeInfo;//充值信息，数组
	
	public static Object fromJson(String jsonStr) {
//		jsonStr = "{"+
//"'code': 0,"+
//"'rechargeInfo': ["+
//"{"+
//"'createTime': '2016-11-07 21:06:32',"+
//"'iccid': '898602B10315C0209075',"+
//"'money': 100,"+
//"'operator': '中国移动',"+
//"'packageName': '移动_150M/月_包年',"+
//"'rechargeStatus': '充值成功',"+
//"'source': '移动端',"+
//"'totalData': 150"+
//"},"+
//"{"+
//"'createTime': '2016-11-07 21:06:36',"+
//"'iccid': '898602B10315C0209075',"+
//"'money': 100,"+
//"'operator': '中国移动',"+
//"'packageName': '移动_150M/月_包年',"+
//"'rechargeStatus': '充值成功',"+
//"'source': '移动端',"+
//"'totalData': 150"+
//"},"+
//"{"+
//"'createTime': '2016-11-07 21:06:41',"+
//"'iccid': '898602B10315C0209075',"+
//"'money': 100,"+
//"'operator': '中国移动',"+
//"'packageName': '移动_150M/月_包年',"+
//"'rechargeStatus': '充值成功',"+
//"'source': '移动端',"+
//"'totalData': 150"+
//"}"+
//"]"+
//"}";
		CX218Back back = (CX218Back)JSONObject.parseObject(jsonStr, CX218Back.class);
		//查询状态
		if(back.getCode() == 0){
			back.setCodeName("查询正常");
		}else if(back.getCode() == 1){
			back.setCodeName("appid、secret、sign有误");
		}else if(back.getCode() == 2){
			back.setCodeName("imsi、iccid、msisdn有误");
		}else if(back.getCode() == 9999){
			back.setCodeName("意外错误");
		}
		return back;
	}

}
